home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / GameboyDev / GBDK / examples / fonts.c < prev    next >
C/C++ Source or Header  |  1999-03-29  |  1KB  |  57 lines

  1. /*
  2.     fonts.c
  3.     Simple example of how to use multiple fonts on the GB
  4.     Michael Hope, 1999.
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <font.h>
  9. #include <console.h>
  10. #include <drawing.h>
  11.  
  12. void main(void)
  13. {
  14.     font_t ibm_font, italic_font, min_font;
  15.     int i;
  16.  
  17.     /* First, init the font system */
  18.     font_init();
  19.  
  20.     /* Load all the fonts that we can */
  21.     ibm_font = font_load(font_ibm);  /* 96 tiles */
  22.     italic_font = font_load(font_italic);   /* 93 tiles */
  23.     
  24.     /* Load this one with dk grey background and white foreground */
  25.     color(WHITE, DKGREY, SOLID);
  26.     
  27.     min_font = font_load(font_min);
  28.  
  29.     /* Turn scrolling off (why not?) */
  30.     mode(get_mode() | M_NO_SCROLL);
  31.  
  32.     /* Print some text! */
  33.     
  34.     /* IBM font */
  35.     font_set(ibm_font);
  36.     printf("Font demo.\n\n");
  37.  
  38.     printf("IBM Font #!?123\n");
  39.  
  40.     /* In italic */
  41.     font_set(italic_font);
  42.     for (i=1; i!=5; i++) {
  43.     printf("In italics, line %u\n", i);
  44.     }
  45.  
  46.     /* With a minimal, colour changed font */
  47.     font_set(min_font);
  48.     printf("Minimal 36 tile font\n");
  49.  
  50.     /* Done */
  51.     font_set(ibm_font);
  52.     printf("\nDone!");
  53. }
  54.  
  55.     
  56.     
  57.